<template>
  <h2>生命周期</h2>
</template>

<script>
import {onBeforeMount, onMounted} from "vue";

export default {
  name: "LifeHook",
  setup(){
    console.log('setup出现在vue实例创建之前的之前');
    //setup里面不存在beforeCreate、Create
    /* beforeMount -> onBeforeMount
       mounted -> onMounted
       beforeUpdate -> onBeforeUpdate
       updated -> onUpdated
       beforeUnmount -> onBeforeUnmount
       unmounted -> onUnmounted
       */
    onBeforeMount(()=>{
      console.log('setup中的onBeforeMount');
    })
    onMounted(()=>{
      console.log('setup中的onMounted');
    })
  },
  //原生生命周期
  beforeCreate() {
    console.log('原生创建vue实例之前beforeCreate');
  },
  Create(){
    console.log('创建vue实例时Create');
  },
  beforeMount() {
    console.log('原生挂载之前beforeMount');
  },
  Mount(){
    console.log('原生挂载时Mount');
  },

}
</script>

<style scoped>

</style>